<?php

if (!isset($_SESSION)) {
    session_start();
}

$dbUser = "root";
$dbPass = "root";
$dbDatabase = "proyectos_ingenieria";
$dbHost = "127.0.0.1";

$dbConn = new mysqli($dbHost, $dbUser, $dbPass, $dbDatabase);

if ($dbConn) {
    ini_set("default_mimetype", "text/html");
    ini_set("default_charset", "utf-8");
    $dbConn->set_charset("utf8");
} else {
    die("<strong>Error:</strong> Could not connect to database.");
}

function better_crypt($input, $rounds = 10) {
    $salt = "";
    $salt_chars = array_merge(range('A', 'Z'), range('a', 'z'), range(0, 9));
    for ($i = 0; $i < 22; $i++) {
        $salt .= $salt_chars[array_rand($salt_chars)];
    }
    return crypt($input, sprintf('$2a$%02d$', $rounds) . $salt);
}
